Problem Note 59930: The CalProb macro code provided in the Example section of The SVMSCORE Procedure chapter is incorrect, a syntax error is displayed
In SAS® Enterprise Miner™, "SAS Enterprise Miner and SAS Text Miner Procedures Reference for SAS 9.4, Fourth Edition" contains code for a CalProb macro. The macro is in the German Credit Data Example on page 279 of the chapter "The SVMSCORE Procedure." However, the macro contains incorrect code.
If you run the macro, then a syntax error is displayed.
2 ! then do; PredProb = -_P_/&minP; end; if PredProb ne . then do; if PredProb > 1 then PredProb
-
22
2 ! = 1; else if PredProb < 0 then PredProb = 0; PredProb =1 - (1+PredProb
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant, a datetime constant, a missing value, INPUT, PUT.
WARNING: Apparent symbolic reference MINP not resolved.
The error is displayed because of an incorrect spelling in the code (where trim(Descr) ="Mimimum F";). However, if you correct the spelling error and run the code, then the results of the PredProb variable are incorrect. There are no errors or warnings to indicate that the results are incorrect.
To correct both problems, download and use the correct macro code from the Full Code tab of this note.
Operating System and Release Information
SAS System | SAS Enterprise Miner | Windows 7 Home Premium 32 bit | 14.2 | 14.3 | 9.4 TS1M4 | 9.4 TS1M5 |
Windows 7 Enterprise x64 | 14.2 | 14.3 | 9.4 TS1M4 | 9.4 TS1M5 |
Windows 7 Enterprise 32 bit | 14.2 | 14.3 | 9.4 TS1M4 | 9.4 TS1M5 |
Microsoft Windows Server 2012 Std | 14.2 | 14.3 | 9.4 TS1M4 | 9.4 TS1M5 |
Microsoft Windows Server 2012 R2 Std | 14.2 | 14.3 | 9.4 TS1M4 | 9.4 TS1M5 |
Microsoft Windows Server 2012 R2 Datacenter | 14.2 | 14.3 | 9.4 TS1M4 | 9.4 TS1M5 |
Microsoft Windows Server 2012 Datacenter | 14.2 | 14.3 | 9.4 TS1M4 | 9.4 TS1M5 |
Microsoft Windows Server 2008 for x64 | 14.2 | | 9.4 TS1M4 | |
Microsoft Windows Server 2008 R2 | 14.2 | | 9.4 TS1M4 | |
Microsoft Windows Server 2008 | 14.2 | | 9.4 TS1M4 | |
Microsoft Windows 10 | 14.2 | 14.3 | 9.4 TS1M4 | 9.4 TS1M5 |
Microsoft Windows 8.1 Pro x64 | 14.2 | 14.3 | 9.4 TS1M4 | 9.4 TS1M5 |
Microsoft Windows 8.1 Pro 32-bit | 14.2 | 14.3 | 9.4 TS1M4 | 9.4 TS1M5 |
Microsoft Windows 8.1 Enterprise x64 | 14.2 | 14.3 | 9.4 TS1M4 | 9.4 TS1M5 |
Microsoft Windows 8.1 Enterprise 32-bit | 14.2 | 14.3 | 9.4 TS1M4 | 9.4 TS1M5 |
Microsoft Windows 8 Pro x64 | 14.2 | 14.3 | 9.4 TS1M4 | 9.4 TS1M5 |
Microsoft Windows 8 Pro 32-bit | 14.2 | 14.3 | 9.4 TS1M4 | 9.4 TS1M5 |
Microsoft Windows 8 Enterprise x64 | 14.2 | 14.3 | 9.4 TS1M4 | 9.4 TS1M5 |
Microsoft Windows 8 Enterprise 32-bit | 14.2 | 14.3 | 9.4 TS1M4 | 9.4 TS1M5 |
Microsoft® Windows® for x64 | 14.2 | 14.3 | 9.4 TS1M4 | 9.4 TS1M5 |
Windows 7 Home Premium x64 | 14.2 | 14.3 | 9.4 TS1M4 | 9.4 TS1M5 |
Windows 7 Professional 32 bit | 14.2 | 14.3 | 9.4 TS1M4 | 9.4 TS1M5 |
Windows 7 Professional x64 | 14.2 | 14.3 | 9.4 TS1M4 | 9.4 TS1M5 |
Windows 7 Ultimate 32 bit | 14.2 | 14.3 | 9.4 TS1M4 | 9.4 TS1M5 |
Windows 7 Ultimate x64 | 14.2 | 14.3 | 9.4 TS1M4 | 9.4 TS1M5 |
64-bit Enabled AIX | 14.2 | 14.3 | 9.4 TS1M4 | 9.4 TS1M5 |
64-bit Enabled Solaris | 14.2 | 14.3 | 9.4 TS1M4 | 9.4 TS1M5 |
HP-UX IPF | 14.2 | 14.3 | 9.4 TS1M4 | 9.4 TS1M5 |
Linux for x64 | 14.2 | 14.3 | 9.4 TS1M4 | 9.4 TS1M5 |
Solaris for x64 | 14.2 | 14.3 | 9.4 TS1M4 | 9.4 TS1M5 |
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
%macro CalProb(indata=, modelfit=, outdata=);
proc sql noprint;
select Value into :minP from &modelfit
where trim(Descr) ="Minimum F";
select Value into :maxP from &modelfit
where trim(Descr) ="Maximum F";
quit;
data &outdata;
PredProb=.;
label PredProb ="Predict Probability";
set &indata;
if (_P_ ge 0) and (&maxP ne 0) then do;
PredProb = _P_/&maxP;
end;
if (_P_ < 0) and (&minP ne 0) then do;
PredProb = -_P_/&minP;
end;
if PredProb ne . then do;
if PredProb > 1 then PredProb = 1;
else if PredProb < -1 then PredProb = -1;
PredProb =1 - (1+PredProb)/2;
end;
run;
%mend CalProb;
Type: | Problem Note |
Priority: | medium |
Date Modified: | 2017-02-09 12:42:57 |
Date Created: | 2017-02-08 18:57:59 |